package com.zshy.base.kit.enums.language.detail;

import com.zshy.base.kit.enums.language.Iso6391LanguageEnum;
import com.zshy.base.kit.enums.language.RealLanguageTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 越南语言枚举
 *
 * @author zhouhengzhe
 * @version 1.0
 * @date 2023/9/7 15:49
 */
@Getter
@AllArgsConstructor
public enum VietnameseLanguageTypeEnum {

    VI("vi", "越南语", RealLanguageTypeEnum.VI.getCode(), Iso6391LanguageEnum.VI),
    VI_VN("vi_VN", "越南语", RealLanguageTypeEnum.VI.getCode(),  Iso6391LanguageEnum.VI);

    /**
     * 语言标识
     */
    private final String code;

    /**
     * 描述
     */
    private final String message;

    /**
     * 实际用的语言
     */
    private final String realCode;

    /**
     * ISO语言标识
     */
    private final Iso6391LanguageEnum iso6391LanguageEnum;

    /**
     * 通过code获取实际用的语言
     * @param language
     * @return
     */
    public static String getRealCodeByCode(String language) {
        for (VietnameseLanguageTypeEnum value : values()) {
            if (value.getCode().equalsIgnoreCase(language)) {
                return value.getRealCode();
            }
        }
        return null;
    }
}
